import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const store = new Vuex.Store({
  state: {
    User:{},
    publicPath: process.env.BASE_URL+"assets",
    AppConfig:{
      //url:config.apiurl
    },


    //this is app the temp_data
    MengWen:false,


    Years:[],
    Select_Year:"",
    Geo_Layer_Name:"",
    Select_Xzqh_properties:{},





    
  },
  temp_data:{
    
  },
  actions:{

    // Set_Geo_layer_name(state,_geo_layer_name){
    //   state.geo_layer_name=_geo_layer_name
    // }
    
    // GetUser(state,moduleR){
    //   return new Promise(function (resolve, reject) { //resolve  reject  2个回调函数
    //     let NeedLoad=[];
    //     let moduleR_Array=[];
    //     let moduleR_back=[];
    //     if(Array.isArray(moduleR)){moduleR_Array = [...moduleR];}
    //     else if(typeof moduleR=="string"){moduleR_Array.push(moduleR)}
    //     else{reject(false);return;}
    //     for(let element of moduleR_Array){
    //       let modulename=element.split('/');modulename=modulename[modulename.length-1];
    //       if(!state.state.imports[modulename]){NeedLoad.push(element);}
    //       else{moduleR_back.push({name:modulename,module:state.state.imports[modulename]})}
    //     }
    //     if(NeedLoad.length==0){resolve(moduleR_back);return;}
    //     esriLoader.loadModules(NeedLoad, {url: state.state.AppConfig.url})
    //     .then(function () {
    //         let backmodules=arguments[0];
    //         if(backmodules.length==NeedLoad.length){
    //           for (let index = 0; index < backmodules.length; index++) {
    //             let modulename=NeedLoad[index].split('/');modulename=modulename[modulename.length-1];
    //             state.state.imports[modulename]=backmodules[index];
    //             moduleR_back.push({name:modulename,module:state.state.imports[modulename]})
    //           }
    //           resolve(moduleR_back);
    //         }
    //         else
    //         {
    //           reject(false); //没有返回
    //         }
    //       },function(error){
    //         reject(false); 
    //       }).catch(function(error){
    //         reject(false); 
    //       })
    //   },function(error){
    //     reject(false); 
    //   });
    // },
  },
  mutations: {
    Set_Geo_layer_name(state,_geo_layer_name){
      state.geo_layer_name=_geo_layer_name
    }
  }
})
export default store